package mongodb.spring.battle;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;

import java.util.Objects;

public class BattleInfo {

    @Id
    private int id;
//    @Indexed(unique = true, name = "idx_battle_id")
    private int battleId;

    public BattleInfo(int id, int battleId){
        this.id = id;
        this.battleId = battleId;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getBattleId() {
        return battleId;
    }

    public void setBattleId(int battleId) {
        this.battleId = battleId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BattleInfo that = (BattleInfo) o;
        return id == that.id &&
                battleId == that.battleId;
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, battleId);
    }

    @Override
    public String toString() {
        return "BattleInfo{" +
                "id=" + id +
                ", battleId=" + battleId +
                '}';
    }
}
